<?php

class Install_sqlApp extends MallbaseApp {

    function index() {
        $mod = & m('privilege');
/*
        $sql  = "ALTER TABLE  `ecm_goods` ADD  `spec_name_3` VARCHAR( 60 ) NOT NULL,ADD  `spec_name_4` VARCHAR( 60 ) NOT NULL";
        $mod->db->query($sql);
        
        $sql  = "ALTER TABLE  `ecm_goods_spec` ADD  `spec_3` VARCHAR( 60 ) NOT NULL,ADD  `spec_4` VARCHAR( 60 ) NOT NULL";
        $mod->db->query($sql);
        
        
        $sql  = "ALTER TABLE  `ecm_shipping` ADD  `cod_regions_price` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL";
        $mod->db->query($sql);
        
        $sql  = "ALTER TABLE  `ecm_account_log` ADD  `orders_group` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL";
        $mod->db->query($sql);
        
        $sql  = "ALTER TABLE  `ecm_store` ADD  `wap_banner` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER  `store_banner`";
        $mod->db->query($sql);
        
        $sql  = "CREATE TABLE `ecm_app_token` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `token` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
        $mod->db->query($sql);
		
		$sql  = "ALTER TABLE  `ecm_store` CHANGE  `store_tuijian_buyer_ratio1`  `store_tuijian_buyer_ratio1` FLOAT( 3, 2 ) UNSIGNED NOT NULL DEFAULT  '0',
		 CHANGE  `store_tuijian_buyer_ratio2`  `store_tuijian_buyer_ratio2` FLOAT( 3, 2 ) UNSIGNED NOT NULL DEFAULT  '0',
		  CHANGE  `store_tuijian_buyer_ratio3`  `store_tuijian_buyer_ratio3` FLOAT( 3, 2 ) UNSIGNED NOT NULL DEFAULT  '0'";
        $mod->db->query($sql);
$sql  = "CREATE TABLE IF NOT EXISTS `ecm_account_check` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `user_name` varchar(60) NOT NULL,
  `money` decimal(10,2) unsigned NOT NULL,
  `money_dj` decimal(10,2) unsigned NOT NULL,
  `income_temp` decimal(10,2) unsigned NOT NULL,
  `income` decimal(10,2) unsigned NOT NULL,
  `outlay` decimal(10,2) unsigned NOT NULL,
  `add_time` int(10) unsigned NOT NULL,
  `last_id` int(10) unsigned NOT NULL,
  `wrong` tinyint(1) unsigned NOT NULL,
  `outlay_temp` decimal(10,2) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";
        $mod->db->query($sql);
        $sql  = "CREATE TABLE IF NOT EXISTS `ecm_account_fix` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `user_name` varchar(60) NOT NULL,
  `admin_id` int(10) unsigned NOT NULL,
  `admin_name` varchar(60) NOT NULL,
  `add_time` int(10) unsigned NOT NULL,
  `log_text` varchar(500) NOT NULL,
  `type` varchar(10) NOT NULL,
  `money_flow` varchar(10) NOT NULL,
  `complete` TINYINT( 1 ) UNSIGNED NOT NULL,
  `money` DECIMAL( 10, 2 ) UNSIGNED NOT NULL,
  `check_id` INT( 10 ) UNSIGNED NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";
        $mod->db->query($sql);
		
        $sql="ALTER TABLE  `ecm_account_check` CHANGE  `money_dj`  `money_dj` DECIMAL( 10, 2 ) NOT NULL";
	$mod->db->query($sql);
        
        $sql="ALTER TABLE  `ecm_account_check` CHANGE  `money`  `money` DECIMAL( 10, 2 ) NOT NULL";
	$mod->db->query($sql);
	
		$sql="ALTER TABLE  `ecm_account_log` ADD  `if_calcu` TINYINT( 1 ) UNSIGNED NOT NULL";
        $mod->db->query($sql);
        
        $sql  = "ALTER TABLE  `ecm_account_log` ENGINE = INNODB";
        $mod->db->query($sql);
        $sql="ALTER TABLE  `ecm_order` ENGINE = INNODB";
        $mod->db->query($sql);
        $sql="ALTER TABLE  `ecm_order_log` ENGINE = INNODB";
        $mod->db->query($sql);
        $sql="ALTER TABLE  `ecm_goods_spec` ENGINE = INNODB";
        $mod->db->query($sql);
        $sql="ALTER TABLE  `ecm_refund` ENGINE = INNODB";
        $mod->db->query($sql);
        $sql="ALTER TABLE  `ecm_member` ENGINE = INNODB";
        $mod->db->query($sql);
        $sql="ALTER TABLE  `ecm_coupon_sn` ENGINE = INNODB";
        $mod->db->query($sql);
        $sql="ALTER TABLE  `ecm_store` ENGINE = INNODB";
        $mod->db->query($sql);
        $sql="ALTER TABLE  `ecm_integral_log` ENGINE = INNODB";
        $mod->db->query($sql);
        $sql  = "ALTER TABLE  `ecm_account_check` ENGINE = INNODB";
        $mod->db->query($sql);*/
		
		$sql="ALTER TABLE  `ecm_account_log` CHANGE  `if_calcu`  `if_calcu` INT( 10 ) UNSIGNED NOT NULL";
        $mod->db->query($sql);

    }

}

?>